package cn.lczze.stock.controller.base;

import cn.lczze.stock.mapper.base.StockBaseMapper;
import cn.lczze.stock.mapper.base.StockInfoMapper;
import cn.lczze.stock.model.base.StockBaseModel;
import cn.lczze.stock.model.base.StockInfo;
import cn.lczze.stock.service.StockBaseService;
import cn.lczze.stock.service.StockCalService;
import cn.lczze.stock.util.AjaxResult;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/info/base")
public class StockInfoController {


    @Autowired
    private StockInfoMapper stockInfoMapper;
    @Autowired
    private StockBaseService stockBaseService;



    @GetMapping(value = "/list")
    public AjaxResult baseList() {
        List<StockInfo> stockInfos = stockInfoMapper.selectAll();
        return AjaxResult.success(stockInfos);
    }

    @GetMapping(value = "/vol/list")
    public AjaxResult volSort() {
        List<StockInfo> jsonObjects = stockBaseService.volSort();
        return AjaxResult.success(jsonObjects);
    }

    @GetMapping(value = "/amount/list")
    public AjaxResult amountSort() {
        List<StockInfo> jsonObjects = stockBaseService.amountSort();
        return AjaxResult.success(jsonObjects);
    }

    @GetMapping(value = "/amount/list/con")
    public AjaxResult amountSortCon() {
        return AjaxResult.success(stockBaseService.amountSortCon());
    }


}
